<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
 %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户管理</title>
<!--                       CSS                       -->
<!-- Reset Stylesheet -->
<link rel="stylesheet" href="/oa/css/reset.css" type="text/css" media="screen" />
<!-- Main Stylesheet -->
<link rel="stylesheet" href="/oa/css/styleMain.css" type="text/css" media="screen" />
<!-- Invalid Stylesheet. This makes stuff look pretty. Remove it if you want the CSS completely valid -->
<link rel="stylesheet" href="/oa/css/invalid.css" type="text/css" media="screen" />
<!--                       Javascripts                       -->
<!-- jQuery -->
<script type="text/javascript" src="/oa/js/jquery-1.3.2.min.js"></script>
<!-- jQuery Configuration -->
<script type="text/javascript" src="/oa/js/simpla.jquery.configuration.js"></script>
<!-- Facebox jQuery Plugin -->
<script type="text/javascript" src="/oa/js/facebox.js"></script>
<!-- jQuery WYSIWYG Plugin -->
<script type="text/javascript" src="/oa/js/jquery.wysiwyg.js"></script>
<!-- jQuery Datepicker Plugin -->
<script type="text/javascript" src="/oa/js/jquery.datePicker.js"></script>
<script type="text/javascript" src="/oa/js/jquery.date.js"></script>
<!--                       Javascripts                       -->
<script type="text/javascript" src="/oa/js/datePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/oa/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="/oa/js/myDate.js"></script>
<script type="text/javascript">
	function findByInfo(){
		if($("#info").val()=="角色"){
		textValues=$("role").val;
			$("#depart").hide();
			$("#parameters").hide();
			$("#role").show();
			$("#search").show();
			$("#depart").val("departs");
			$("#parameters").val("");
		}else if($("#info").val()=="部門"){
			textValues=$("#depart").val();
			$("#depart").show();
			$("#search").show();
			$("#role").hide();
			$("#role").val("role"); 
			$("#parameters").val("");
		}else if($("#info").val()=="姓名"){
			textValues=$("#parameters").val();
			$("#parameters").show();
			$("#role").hide();
			$("#depart").hide();
			$("#role").val("role");
			$("#depart").val("depart");
		}
	}

	function findByList(){
		role = $("#role").val();
		depart = $("#depart").val();
		parameters = $("#parameters").val();
		currentPage = 1;
		var url = "user/fuzzySearch.action";
		if(info=='name'){
			$.getJSON(url,{'user.role.serialNumber':roleName,'user.name':parameters},function(data){getResult(data);});
		}else if(info==null){
			alert("请选择查询根据！"); 
		}
	}
	
	$(document).ready(function(e) {
        $("#checkAll").click(function(){
			$("body :checkbox").attr("checked",$("#checkAll").attr("checked"));
		});
		$("#search").click(function(){
			var form = document.forms[0];
			form.action = '<s:url namespace="/page/permanage" action="deleteUser" />';
			form.submit();
		});
    });
</script>
</head>
<body>
<div>
  <!-- Wrapper for the radial gradient background -->
  <div>
    <!-- Main Content Section with everything -->
    <div class="clear"></div>
    <!-- End .clear -->
    <div class="content-box">
      <!-- Start Content Box -->
      <div class="content-box-header">
        <h3>用户管理</h3>
        <ul class="content-box-tabs">
          <li><a href="#tab1" class="default-tab">浏览</a></li>
           <li><a href="/oa/page/permanage/goUser.action">新增</a></li>
         </ul>
        <div class="clear"></div>
      </div>
      <!-- End .content-box-header -->
      <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
       <!--搜索框-->
        <div class="searchPanel"><br />
          <label>请选择搜索类别：</label>
          <s:select id="info" list="{'角色','部門','姓名'}" onchange="findByInfo()"></s:select>        
          <s:select id="depart" list="departs" listKey="id" listValue="name" style="display:none"></s:select>
          <s:select id="role" list="roles" listKey="roleId" listValue="name" style="display:none"></s:select>
          <s:textfield id="parameters" style="display:none"></s:textfield>
         <input id="search" class="button" type="submit" value="搜一下" onclick="findByList()" /><br /><br />
          </div>
       <table>
            <thead>
              <tr>
                <th>
                  <input class="check-all" type="checkbox" id="checkAll"/>全选
                  &nbsp;&nbsp;
                  <input type="button" value="批量删除" id="btnDel" />
                </th>
                <th>用户名称</th>
                <th>用户密码</th>
                <th>性别</th>
                <th>所在部门</th>
                <th>角色</th>
                <th>电话号码</th>
                <th>状态</th>
                <th>操作</th>
              </tr>
            </thead>
             <s:form namespace="/page/permanage" action="listUser" id="userForm">
             <s:fielderror></s:fielderror>
			<s:hidden name="currentpage"></s:hidden>
             <tbody>
             <s:iterator value="pageView.records" status="entry">
				<tr>
					<td><input class="check-all" type="checkbox" value="${userName}" name="delUserName"/></td>
					<td>${userName}</td>
					<td>${password}</td>
					<td>${gender }</td>
					<td>${depart.name }</td>
					<td>${role.name }</td>
                    <td>${mobileTelNo }</td>
                    <td>${state }</td>
                    <td>
                  <img onclick="location.href='<s:url action="showUser" namespace="/page/permanage"><s:param name="user.userName" value="userName"/></s:url>'" 
                       title="编辑" src="/oa/images/bt_edit.gif" alt="Edit" />
                &nbsp;&nbsp;&nbsp;
                  <img onclick="deleteUser('${id}','${name}')" title="删除" src="/oa/images/bt_del.gif" alt="Delete" />
                </td>
				</tr>
			</s:iterator>
            </tbody>
            <tfoot>
              <tr>
				<td colspan="9">
					<div class="pagination align-right">
						<s:include value="/oa/page/share/paging.jsp"></s:include>
					</div>
					<div class="clear"></div>
				</td>
			</tr>
            </tfoot>
       	</s:form>
          </table>
        </div>
        <!-- End #tab1 -->
      </div>
      <!-- End .content-box-content -->
    </div>
  </div>
  <!-- End #main-content -->
</div>
</body>
<!-- Download From www.exet.tk-->
</html>
